export function debounce(fn, wait) {
    let timeout = null;
    return function () {
        const context = this;
        const args = arguments;
        timeout && clearTimeout(timeout);
        const callNow = !timeout;
        timeout = setTimeout(() => {
            timeout = null;
        }, wait);
        callNow && fn.apply(context, args);
    };
}
